package com.kfm.service;

import com.kfm.dao.UserDao;
import com.kfm.model.User;

import java.sql.SQLException;

/**
 * 处理用户的所有业务逻辑
 */
public class UserService {

    private UserDao userDao = new UserDao();

    public User login(String username, String password) {
        if (username == null || password == null) {
            return null;
        }
        // 去数据访问层查询是否存在这样的一个用户
        try {
            return userDao.selectByUsernameAndPassword(username, password);
        } catch (SQLException e) {
            e.printStackTrace();
            return null;
        }
    }
}
